package com.ashok.mvc.controller;

import java.security.Principal;

import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

@Controller
@RequestMapping(value = "/simple")
public class Welcome {

	@RequestMapping(method=RequestMethod.GET,value="/welcome")
	public String printMessage(ModelMap map,Principal principal){
		String user = principal.getName();
		
		map.addAttribute("user",user);
		map.addAttribute("message","Hello from Spring Security");
		
		return "welcome";
	}
}
